using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class PlayerInfoUI : MonoBehaviour
{
    /// <summary>
    /// 长度文本
    /// </summary>
    public TextMeshProUGUI LenghtText;

    private void OnEnable()
    {
        // 注册玩家长度改变回调
        PlayerLength.OnPlayerLengthChange += OnPlayerLengthChange;
    }

    private void OnDisable()
    {
        // 注销玩家长度改变回调
        PlayerLength.OnPlayerLengthChange -= OnPlayerLengthChange;
    }
    
    /// <summary>
    /// 玩家长度改变回调
    /// </summary>
    /// <param name="value"></param>
    private void OnPlayerLengthChange(ushort value)
    {
        LenghtText.text = "Length : "+ value;
    }
}
